package com.chixing.day04.day04Test;

public class Account {
    private int accNo;   //账户账号
    private String accName;  //账户姓名
    private String accPassword;  //账户密码
    private long accTelno;  //账户手机号
    private float accBalance; //账户余额

    private float annualInterestRate;//年利率
    private int accType; //账户类型 0:储蓄账户, 1：信用账户

    public Account() {

    }

    public Account(int accNo, String accName, String accPassword, long accTelno, float accBalance, float annualInterestRate, int accType) {
        this.accNo = accNo;
        this.accName = accName;
        this.accPassword = accPassword;
        this.accTelno = accTelno;
        this.accBalance = accBalance;
        this.annualInterestRate = annualInterestRate;
        this.accType = accType;
    }

    public float getAnnualInterestRate() {
        return annualInterestRate;
    }

    public void setAnnualInterestRate(float annualInterestRate) {
        this.annualInterestRate = annualInterestRate;
    }

    public int getAccNo() {
        return accNo;
    }

    public void setAccNo(int accNo) {
        this.accNo = accNo;
    }

    public String getAccName() {
        return accName;
    }

    public void setAccName(String accName) {
        this.accName = accName;
    }

    public String getAccPassword() {
        return accPassword;
    }

    public void setAccPassword(String accPassword) {
        this.accPassword = accPassword;
    }

    public long getAccTelno() {
        return accTelno;
    }

    public void setAccTelno(long accTelno) {
        this.accTelno = accTelno;
    }

    public float getAccBalance() {
        return accBalance;
    }

    public void setAccBalance(float accBalance) {
        this.accBalance = accBalance;
    }

    public int getAccType() {
        return accType;
    }

    public void setAccType(int accType) {
        this.accType = accType;
    }

    //月利润
    public float getMonthInterest() {
        return annualInterestRate / 12;
    }

    //账户存款
    public void depoist(float money) {
        accBalance += money;
        System.out.println("存款成功！余额为:" + accBalance);
    }

    //账户取款
    public void withdraw(float money) {
        if (money > accBalance) {
            System.out.println("余额不足");
        } else {
            accBalance -= money;
            System.out.println("取款成功！余额为:" + accBalance);
        }
    }
}
